package com.wc.alorithm_luogu.P1116;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/5/13 15:47
 * @description https://www.luogu.com.cn/problem/P1116
 * 车厢重组
 *
 * 逆序数
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        int[] array = new int[n];

        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }

        int ans = 0;

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < i; j++) {
                if (array[j] > array[i]) {
                    ans++;
                }
            }
        }
        System.out.println(ans);
    }
}
